package org.kjtc.mapper;

import org.apache.ibatis.annotations.*;
import org.kjtc.entity.State;
import org.kjtc.entity.WorkState;

import java.util.List;

/**
 * Created by Administrator on 2017/12/13 0013.
 */
@Mapper
public interface SetUpMapper {

    @Select("select * from state")
     List<State> getAllState();

    @Select("select * from workstate WHERE WorkStateName=\'紧急\'")
     List<WorkState> getWorkState();

    @Insert("INSERT INTO state (StateID,StateName,StateColor) VALUES ((select max(s2.stateID)+1 from state s2),#{StateName},#{StateColor})")
     int createState(State state);

    @Delete("DELETE FROM state WHERE StateID=#{StateID}")
    int deleteState(State state);

    @Update("UPDATE workstate SET WorkStateValue=#{WorkStateValue} WHERE WorkStateName=\'紧急\'")
    int updateWorkState(WorkState workState);

    @Update("UPDATE state SET StateColor=#{StateColor} WHERE StateID=#{StateID}")
    int updateState(@Param("StateID")Integer StateID,@Param("StateColor") String StateColor);


}
